<!DOCTYPE html>
<html>
<head>
    <title>资源列表</title>
    {% include 'system/common/header.html' %}
</head>
<body class="pear-container">
<ul class="layui-nav layui-bg-gray layui-nav-child-c">
    <li class="layui-nav-item">资源列表</li>
</ul>    
<div class="layui-card">
    <div class="layui-card-body layui-col-md6 layui-col-md-offset4">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">资源名</label>
                <div class="layui-input-inline">
                    <input type="text" name="shareName" placeholder="" class="layui-input">
                </div>
                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="role-query">
                    <i class="layui-icon layui-icon-search"></i>
                    查询
                </button>
                <button type="reset" class="pear-btn pear-btn-md">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
            <div class="layui-text">
                <p>如果因为分辨率太小导致表格中文的字显示不全，请将鼠标放到对应表格中，然后点击右侧出现的下拉箭头</p>
              </div>
        </form>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-body layui-col-md8 layui-col-md-offset2">
        <table id="share-table" lay-filter="share-table"></table>
    </div>
</div>
</body>

{% include 'system/common/footer.html' %}
<script>
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.jquery
        let popup = layui.popup

        let MODULE_PATH = '/blog/share/'

        let cols = [
            [
                {field:'index', width:80, title: '序号',type:'numbers'},
                {title: '资源名', field: 'name', align: 'center'},
                {title: '资源链接', field: 'weblink', align: 'center'},
                {title: '密码', field: 'default_passcode', align: 'center'}
            ]
        ]

        table.render({
            elem: '#share-table',
            url: MODULE_PATH + 'data',
            page: true,
            limit: 100,
            limits: [100, 200, 500],
            cols: cols,
            skin: 'line',
            toolbar: '#share-toolbar',
            defaultToolbar: ['filter', 'print', 'exports']
        })

        form.on('submit(role-query)', function (data) {
            table.reload('share-table', {where: data.field})
            return false
        })
    })
</script>
</html>
